package com.dragon.modules.yuegou.enums.code;

import com.dragon.common.constant.enums.IBusinessCode;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;


/**
 * 会员业务状态码
 * 
 * @author 刘武
 *
 */
public enum MerchantCode implements IBusinessCode {

	/**
	 * 商户名称不能重复
	 * */
	MERCHANT_NAME_EXISTS(12000,"商户名称不能重复"),

	/**
	 * 商户折扣不能为空
	 * */
	MERCHANT_DISCOUNT_NOTNULL(12001,"商户折扣不能为空"),

	/**
	 * 商户折扣必须是1到100之间的整数
	 * */
	MERCHANT_DISCOUNT_FORMAT(12002,"商户折扣必须是1到100之间的整数"),

	/**
	 * 商户二维码图片生成失败
	 * */
	MERCHANT_QRCODE_FAILURE(12003,"商户二维码图片生成失败"),

	/**
	 * 分组名称不能重复
	 * */
	MERCHANT_GROUP_NAME_EXISTS(12005,"分组名称不能重复"),

	/**
	 * 业态名称不能重复
	 * */
	BTYPE_NAME_EXISTS(12006,"业态名称不能重复"),
	
	/**
	 * 商户不存在
	 * */
	MERCHANT_NOT_EXIST(12007,"商户不存在"),

	/**
	 * 账号不能重复
	 * */
	MOBILE_EXISTS(12008,"账号不能重复"),

	/**
	 * 商户该日期已存在销售数据
	 * */
	SALES_EXISTS(12009,"商户该日期已存在销售数据"),

	PASSWORD_MISMATCH(12010,"两次密码不一致"),

	IS_NOT_MOBILE(12011,"手机号格式错误"),

	CHILD_USER_NOT_EXIST(12012,"子账号户不存在"),

	MERCHANT_NOT_SAME(12013,"不是您的子账号，不能删除子账号"),

	USER_IS_NOT_MERCHANT(12014,"不是主账号，不能删除子账号"),

	USER_NOT_EXIST(12015,"账号户不存在"),

	NOT_FIND_BANK_CARD(12016,"商户找到银行卡"),
	
	MERCHANT_PASSWORD(12017,"商户密码不一致"),

	INVALID_MERCHANT_QRCODE(12018,"无效的二维码"),

	LEVEL_ERROR(12019,"旗舰商家不能降级购买高级商家产品"),

	FORM_IS_NO_EMPTY(12020,"模板类型为常用模板必须填写业态"),
	
	FEE_LV(12021,"费率不能小于等于0大于等于1"),
	
	BANK_NOT_REPEAT_BINGDING(12022,"商户不能绑定多张银行卡"),

	DISTRIBUTION_PERSONNEL_DO_NOT_EXIST(12023,"分配人员不存在"),

	CHECK_BANK_FAIL(12024, "银行卡和银行不一致"),
	
	APPID_NOT_EXIEST(12025,"APPID没有找到"),
	
	APPID_NOT_USER(12026,"APPID没有找到对应用户"),
	
	APPID_USER_IS_NOT_MERCHANT(12027,"APPID对应用户不是商户"),
	
	MOBILE_REGISTERED(12028,"手机号已经被%s注册"),
	
	OPENID_NOT_FIND(12029,"OPENID没有找到注册用户"),
	
	OPENID_NOT_FIND_MERCHAN_USER(12030,"OPENID没有找到商户用户"),
	
	PASSWORD_IS_NOSTANDARD(12031,"密码为6-20位数字、字母、字符的组合"),
	
	OLD_PAY_PWD_ERROR(12032,"旧密码错误"),

	UN_PAY_CONFIG(12033,"商户未配置支付账号，不能支付"),
	
	TUESDAY_WITHDRAW_IS_NECESSARY(12034,"请于每周二申请提现"),

	OPENID_IS_NULL(12035,"openid 为空，不能支付"),

	SALES_IS_NULL(12036,"导入销售数据,第s%行销售额不能为负数或空"),

	VOLUME_IS_NULL(12037,"导入销售数据,第s%行销售额不能为负数或空"),

	BERTH_NUMBER_REPEAT(12038,"导入销售数据,第s%行商户铺位号出现重复，请至商户管理修改商户的铺位号"),

	MERCHANT_IS_NULL(12039,"导入销售数据,第s%行商户不存在"),

	MERCHANT_REPEAT(12040,"导入销售数据,第s%行商户存在重复"),
	
	VCODE_IS_NOT_NULL(12041,"验证码不能为空"),
	
	REMOVE_BEFORE_CLOSING(12042,"您当前有配送商品正在售卖，请先下架，再关闭"),
	
	GET_LAT_LON_ERROR(12043,"获取经纬度错误"),
	
	CREATE_DADA_STOR_ERROR(12044,"创建达达门店错误"),
	
	CENERATE_LINKS_ERROR(12045	,"生成充值链接错误"),

	USER_IS_NOT_REFUND(12046,"不是主账号，不能退款"),

	MERCHANT_IS_NOT_REFUND(12047,"不是当前商家订单，不能退款"),

	OLD_DATA_IS_NOT_REFUND(12048,"历史数据，不能退款"),

	STATUS_IS_NOT_REFUND(12049,"不是已支付状态，不能退款"),
	
	YUE_CARD_DO_NOT_SUPPORTED_REFUND(12050,"由于平台原因，悦卡暂时不支持退款"),
	
	ORDER_REFUNDED(12051,"该订单已提交退款，不能重复退款"),
	MERCHANT_CARD_NUMBER_INFORMATION_CANNOT_BE_EMPTY(12052,"商户卡号信息不能为空"),
	BANK_CARD_NUMBER_IS_ONE_TWENTY_DIGITS(12053,"银行卡号为1-30位数字"),
	BANK_ACCOUNT_NAME_WITH_TWENTY_CHINESE_CHARACTERS(12054,"银行开户名为20个汉字"),
	THE_NUMBER_OF_WORDS_IN_THE_STORE_PROFILE_EXCEEDS_THE_LIMIT(12055,"店铺简介字数超过限制"),

	CHECK_SUCCSEE(12056,"已审核通过不能重复审核"),

	APPLY_EXIST(12057,"已存在申请不能重复申请"),

	APPLY_NAME_EXIST(12058,"已存在相同店铺名申请不能重复申请"),

	APPLY_NOT_EXIST(12059,"申请不存在，不能审核"),
	
	BANK_NOT_EXIST(12060,"银行不存在，请选择正确的银行"),
	/**
	 * 状态码说明
	 */
	TODO(12999, "提示消息");

	private final Integer code;

	private final String message;

	private MerchantCode(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	/**
	 * 把code转化为ResponseCode枚举
	 * 
	 * @param code 代码
	 * @return
	 */
	public static MerchantCode from(Integer code) {
		if (code == null) {
			return null;
		}
		return CODE_MAP.get(code);
	}

	/**
	 * Code Map for ResponseCode
	 */
	private static final Map<Integer, MerchantCode> CODE_MAP = Stream.of(MerchantCode.values())
			.collect(Collectors.toMap(MerchantCode::getCode, e -> e));

    //二维码秘钥
    public static final String QRCODE_KEY ="355780a264c261700db922e121cb78585506095c190893fbcad6dba0dae79136";
	
}
